package com.gomtel.smartdevice.widget;

import com.gomtel.smartdevice.global.DataClass;
import com.gomtel.smartdevice.moudle.DataManager;
import com.gomtel.smartdevice.utils.LogUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/5/22 0022.
 */

public class MaxDataIntervalClass {

    public DataManager dataManager;

    public MaxDataIntervalClass() {
    }

    public MaxDataIntervalClass(DataManager dataManager) {
        this.dataManager = dataManager;
    }

    public static int getMaxInterval(int args[], int standard) {
        int min;
        int max;
        min = max = args[0];
        for (int i = 0; i < args.length; i++) {
            System.out.print(args[i] + " ");
            if (args[i] > max)
                max = args[i];
            if (args[i] < min)
                min = args[i];
        }
        int center = max + min;
        for (int i = 0; i < 999; i++) {
            if (center < standard * i) {
                center = standard * i;
                return center;
            }
        }
        return center;
    }

    public ArrayList<String> getXAxisShowLable() {
        ArrayList<String> m = new ArrayList<>();
        for (int i = 0; i < 24; i++) {
            if (i == 0 || i == 12 || i == 23) {
                m.add(String.valueOf(i));
            } else {
                m.add("");
            }
        }
        return m;
    }

    public ArrayList<String> getXAxisShowMonthLable(int indexMonth) {
        ArrayList<String> m = new ArrayList<>();
        List<String> dayListOfMonth = CalenderUtilsClass.getDayListOfMonth(indexMonth);
        LogUtil.e("MaxDataIntervalClass","dayListOfMonth.size() : " + dayListOfMonth.size());
        for (int i = 1; i < dayListOfMonth.size() + 1; i++) {
            if (i % 5 == 0) {
                if (i + 1 == dayListOfMonth.size()){
                    m.add("");
                }else {
                    m.add(String.valueOf(i));
                }
            } else if (i == 1) {
                m.add(String.valueOf(i));
            } else if (i == dayListOfMonth.size()) {
                m.add(String.valueOf(i));
            } else {
                m.add("");
            }
        }
        for (int i = 0; i < m.size(); i++) {
//            LogUtil.e("MaxDataIntervalClass", "dayListOfMonth : " + m.get(i));
        }
        return m;
    }

}

